<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateIntegralProductsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('integral_products', function (Blueprint $table) {
            $table->id();
            $table->integer('product_id')->comment('商品ID')->index();
            $table->integer('merchant_id')->comment('商户ID')->index();
            $table->string('recommend_image')->comment('推荐图');
            $table->string('title')->comment('拼团标题');
            $table->json('rotation_chart')->comment('轮播图');
            $table->integer('shel_status')->default(1)->comment('上架 0:关闭 1:开启');
            $table->string('description')->nullable()->comment('内容');
            $table->string('unit_name')->comment('单位名称');
            $table->decimal('integral',10,2)->comment('兑换积分');
            $table->integer('sort')->default(0)->comment('排序');
            $table->integer('sales')->default(0)->comment('销量');
            $table->integer('stock')->default(0)->comment('库存');
            $table->decimal('postage',10,2)->default(0.00)->comment('邮费');
            $table->integer('browse')->default(0)->comment('浏览量');
            $table->decimal('weight',8,2)->default(0.00)->comment('重量');
            $table->decimal('volume',8,2)->default(0.00)->comment('体积');
            $table->integer('num')->comment('用户兑换数量限制');
            $table->integer('once_num')->default(1)->comment('兑换次数');
            $table->tinyInteger('is_recommend')->default(0)->comment('是否推荐 【0:不推荐 1:推荐】');
            $table->tinyInteger('merchant_use')->default(0)->comment('商户是否可用1可用0不可用');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('integral_products');
    }
}
